package com.example.food_contract_system.controller;

import com.example.food_contract_system.service.RotationService;
import com.example.food_contract_system.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author LiHaoyang
 * @date 2023/7/14  13:03
 **/
@RestController
@RequestMapping("/rotation")
public class RotationController {

    @Autowired
    private RotationService rotationService;

    @PostMapping("/insertRotation")
    public R insertRotation(@RequestBody String href){
        R result = rotationService.insertRotation(href);
        return result;
    }

    @GetMapping("/getRotation")
    public R getRotation(){
        R result = rotationService.getRotation();
        return result;
    }

    @GetMapping("/showPicture/{pId}/{pStatus}")
    public R showPicture(@PathVariable("pId") String pId,
                         @PathVariable("pStatus") String pStatus){
        R result = rotationService.showPicture(pId,pStatus);
        return result;
    }

    @GetMapping("/deletePicture/{pId}")
    public R deletePicture(@PathVariable("pId") String pId){
        R result = rotationService.deletePicture(pId);
        return result;
    }

    @GetMapping("/getRotationList")
    public R getRotationList(){
        R result = rotationService.getRotationList();
        return result;
    }
}
